// <copyright file="ExtensionMethods.cs" company="Alan Dean">
// The MIT License

// Copyright (c) 2008 Alan Dean

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// </copyright>
// <author>Alan Dean</author>
// <email>alan.dean@thoughtpad.net</email>

namespace Semantic.Rdf.Foaf
{
    using System;
    using System.Diagnostics.CodeAnalysis;

    /// <summary>
    /// Represents FOAF extension methods.
    /// <para>This class cannot be inherited.</para>
    /// </summary>
    public static class ExtensionMethods
    {
        #region public static Depiction FoafDepiction(this Triple, Image)
        /// <summary>
        /// Creates an <see cref="T:Semantic.Rdf.Foaf.Depiction">foaf:depiction</see> with the same subject
        /// as this <paramref name="triple"/> and the specified <paramref name="obj">object</paramref>.
        /// </summary>
        /// 
        /// <param name="triple">The triple to be extended.</param>
        /// <param name="obj">The foaf:depiction foaf:Image object.</param>
        /// 
        /// <returns>
        /// An <see cref="T:Semantic.Rdf.Foaf.Depiction"/> with the same subject as this instance.
        /// </returns>
        /// 
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="triple"/> is a <see langword="null"/> reference.<br/>-or-<br/>
        /// <paramref name="obj"/> is a <see langword="null"/> reference.
        /// </exception>
        [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "obj", Justification = "This is the appropriate naming.")]
        public static Depiction FoafDepiction(this Triple triple, Image obj)
        {
            if (null == triple)
            {
                throw new ArgumentNullException("triple");
            }

            return new Depiction(triple.Subject, obj);
        }
        #endregion

        #region public static Homepage FoafHomepage(this Triple, Document)
        /// <summary>
        /// Creates an <see cref="T:Semantic.Rdf.Foaf.Homepage">foaf:homepage</see> with the same subject
        /// as this <paramref name="triple"/> and the specified <paramref name="obj">object</paramref>.
        /// </summary>
        /// 
        /// <param name="triple">The triple to be extended.</param>
        /// <param name="obj">The foaf:homepage foaf:Document object.</param>
        /// 
        /// <returns>
        /// An <see cref="T:Semantic.Rdf.Foaf.Homepage"/> with the same subject as this instance.
        /// </returns>
        /// 
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="triple"/> is a <see langword="null"/> reference.<br/>-or-<br/>
        /// <paramref name="obj"/> is a <see langword="null"/> reference.
        /// </exception>
        [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "obj", Justification = "This is the appropriate naming.")]
        public static Homepage FoafHomepage(this Triple triple, Document obj)
        {
            if (null == triple)
            {
                throw new ArgumentNullException("triple");
            }

            return new Homepage(triple.Subject, obj);
        }
        #endregion

        #region public static Name FoafName(this Triple, object)
        /// <summary>
        /// Creates an <see cref="T:Semantic.Rdf.Foaf.Name">foaf:name</see> with the same subject
        /// as this <paramref name="triple"/> and the specified <paramref name="obj">object</paramref>.
        /// </summary>
        /// 
        /// <param name="triple">The triple to be extended.</param>
        /// <param name="obj">The foaf:name foaf:Document object.</param>
        /// 
        /// <returns>
        /// An <see cref="T:Semantic.Rdf.Foaf.Name"/> with the same subject as this instance.
        /// </returns>
        /// 
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="triple"/> is a <see langword="null"/> reference.<br/>-or-<br/>
        /// <paramref name="obj"/> is a <see langword="null"/> reference.
        /// </exception>
        [SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "obj", Justification = "This is the appropriate naming.")]
        public static Name FoafName(this Triple triple, object obj)
        {
            if (null == triple)
            {
                throw new ArgumentNullException("triple");
            }

            return new Name(triple.Subject, obj);
        }
        #endregion
    }
}